---
layout: single
property_name: padding
---

<section id="padding" class="property property--shorthand">
  <header class="property-header">
    <nav class="property-links">
        <a class="property-collection" href="{{site.url}}/box-model/">
          In collection: <strong>box-model</strong>
        </a>
      <a class="property-links-direct" href="{{site.url}}/property/padding/" data-property-name="padding" data-tooltip="Single page for this property">Permalink</a>
      <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="padding">Share</a>
      <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/padding" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a>
    </nav>
    <h2 class="property-name">
      <a href="#padding"><span>#</span>padding</a>
    </h2>
    <div class="property-description">
      <p>Shorthand property for <code class="shorthand"><a class="hash" href="{{site.url}}/property/padding-top" data-property-name="padding-top">padding-top</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/padding-right" data-property-name="padding-right">padding-right</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/padding-bottom" data-property-name="padding-bottom">padding-bottom</a></code>  and  <code class="shorthand"><a class="hash" href="{{site.url}}/property/padding-left" data-property-name="padding-left">padding-left</a></code>.</p>

    </div>

  </header>

    <style type="text/css">.padding { background: #05ffb0;padding: 0; }</style>


    <style type="text/css">.padding .block { padding: 0; }.padding .square { align-items: center;background: rgba(0,0,0,0.3);border-radius: 0;display: flex;height: auto;justify-content: center;width: auto; }.padding .container { align-items: stretch;display: flex; }.padding .block--alpha { flex-grow: 1;flex-shrink: 1; }</style>


    <section class="example">
      <header class="example-header">
        <p class="example-name">
            <code class="example-default" data-tooltip="This is the property's default value">default</code>


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="padding: 0;">padding: 0;</code>
        </p>
        <div class="example-description">
          <p>Removes all paddings.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div padding " id="padding-0"><div class="square square--top"></div><div class="container"><div class="square square--left"></div><div class="block block--alpha"><strong>Target </strong></div><div class="square square--right"></div></div><div class="square square--bottom"></div></div>
        </div>
      </aside>
        <style type="text/css">#padding-0 .box { display: none; }</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="padding: 30px;">padding: 30px;</code>
        </p>
        <div class="example-description">
          <p>When using <strong>1</strong> value, the padding is set for <strong>all 4 sides</strong>.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div padding " id="padding-30px"><div class="square square--top"></div><div class="container"><div class="square square--left"></div><div class="block block--alpha"><strong>Target </strong></div><div class="square square--right"></div></div><div class="square square--bottom"></div></div>
        </div>
      </aside>
        <style type="text/css">#padding-30px .square--top { height: 30px; }#padding-30px .square--top:before { content: "30px"; }#padding-30px .square--bottom { height: 30px; }#padding-30px .square--bottom:before { content: "30px"; }#padding-30px .square--left:before { content: "30px";width: 30px; }#padding-30px .square--right:before { content: "30px";width: 30px; }</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="padding: 30px 60px;">padding: 30px 60px;</code>
        </p>
        <div class="example-description">
          <p>When using <strong>2</strong> values:</p>
<ul><li>the <strong>first</strong> value is for <strong>top/bottom</strong></li><li>the <strong>second</strong> value is for <strong>right/left</strong></li></ul><p>To remember the <strong>order</strong> think about the values you <strong>haven&#39;t defined</strong>.</p>
<p>If you enter <strong>2</strong> values (top/right), you <em>omit</em> setting bottom and left. Because bottom is the vertical counterpart of top, it will use top’s value. And because left is the horizontal counterpart of right, it will use right’s value.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div padding " id="padding-30px-60px"><div class="square square--top"></div><div class="container"><div class="square square--left"></div><div class="block block--alpha"><strong>Target </strong></div><div class="square square--right"></div></div><div class="square square--bottom"></div></div>
        </div>
      </aside>
        <style type="text/css">#padding-30px-60px .square--top { height: 30px; }#padding-30px-60px .square--top:before { content: "30px"; }#padding-30px-60px .square--bottom { height: 30px; }#padding-30px-60px .square--bottom:before { content: "30px"; }#padding-30px-60px .square--left:before { content: "60px";width: 60px; }#padding-30px-60px .square--right:before { content: "60px";width: 60px; }</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="padding: 30px 60px 45px;">padding: 30px 60px 45px;</code>
        </p>
        <div class="example-description">
          <p>When using <strong>3</strong> values:</p>
<ul><li>the <strong>first</strong> value is for <strong>top</strong></li><li>the <strong>second</strong> value is for <strong>right/left</strong></li><li>the <strong>third</strong> value is for <strong>bottom</strong></li></ul><p>To remember the <strong>order</strong> think about the values you <strong>haven&#39;t defined</strong>.</p>
<p>If you enter <strong>3</strong> values (top/right/bottom), you omit setting left. As right’s counterpart, it will use its value.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div padding " id="padding-30px-60px-45px"><div class="square square--top"></div><div class="container"><div class="square square--left"></div><div class="block block--alpha"><strong>Target </strong></div><div class="square square--right"></div></div><div class="square square--bottom"></div></div>
        </div>
      </aside>
        <style type="text/css">#padding-30px-60px-45px .square--top { height: 30px; }#padding-30px-60px-45px .square--top:before { content: "30px"; }#padding-30px-60px-45px .square--bottom { height: 45px; }#padding-30px-60px-45px .square--bottom:before { content: "45px"; }#padding-30px-60px-45px .square--left:before { content: "60px";width: 60px; }#padding-30px-60px-45px .square--right:before { content: "60px";width: 60px; }</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="padding: 30px 60px 45px 85px;">padding: 30px 60px 45px 85px;</code>
        </p>
        <div class="example-description">
          <p>When using <strong>4</strong> values:</p>
<ul><li>the <strong>first</strong> value is for <strong>top</strong></li><li>the <strong>second</strong> value is for <strong>right</strong></li><li>the <strong>third</strong> value is for <strong>bottom</strong></li><li>the <strong>fourth</strong> value is for <strong>left</strong></li></ul><p>To remember the <strong>order</strong>, start at the <strong>top</strong> and go <strong>clockwise</strong>.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div padding " id="padding-30px-60px-45px-85px"><div class="square square--top"></div><div class="container"><div class="square square--left"></div><div class="block block--alpha"><strong>Target </strong></div><div class="square square--right"></div></div><div class="square square--bottom"></div></div>
        </div>
      </aside>
        <style type="text/css">#padding-30px-60px-45px-85px .square--top { height: 30px; }#padding-30px-60px-45px-85px .square--top:before { content: "30px"; }#padding-30px-60px-45px-85px .square--bottom { height: 45px; }#padding-30px-60px-45px-85px .square--bottom:before { content: "45px"; }#padding-30px-60px-45px-85px .square--left:before { content: "85px";width: 85px; }#padding-30px-60px-45px-85px .square--right:before { content: "60px";width: 60px; }</style>
    </section>

</section>
